package com.bigscreen.service.impl;

import com.bd1904.common.DateUtil;
import com.bigscreen.dao.TimeAmtDao;
import com.bigscreen.service.TimeAmtService;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.Random;

@Repository
public class TimeAmtServiceImpl implements TimeAmtService {
    @Autowired
    private TimeAmtDao taDao;

    Random random = new Random();
    @Override
    public String timeAmt() {
        String time = DateUtil.formatDate(new Date());
        double timeAmt = taDao.getAmtByTime(time);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("xTime",time);
        jsonObject.put("timeAmt",timeAmt);
        return jsonObject.toString();

        //
    }
}
